package org.gwt.project.tools.quickfix;

import org.eclipse.core.resources.IMarker;
import org.eclipse.ui.IMarkerResolution;
import org.eclipse.ui.IMarkerResolutionGenerator;
import org.eclipse.ui.IMarkerResolutionGenerator2;

public class Project implements IMarkerResolutionGenerator, IMarkerResolutionGenerator2 {

	@Override
	public IMarkerResolution[] getResolutions(IMarker marker) {
		
		// Create QuickFix description message
		String project = marker.getResource().getProject().getName();
		String msg = "Goto build path -> select 'Projects' -> add required project '"+project+"' -> OK";
		
		// Finished  
		return new IMarkerResolution[]{
			new ConfigureBuildPath(msg)
		};
	}

	@Override
	public boolean hasResolutions(IMarker marker) {
		return marker.getAttribute(Generator.PROBLEM_ID, "").equals(Generator.PROJECT);
	}
}